package com.own.center;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.own.core.html.form.validateType;
import com.own.core.html.form.dropDown.DropDown;
import com.own.core.html.form.textField.TextField;
import com.own.core.object.Dao;
import com.own.core.object.lookup.Gender;

@Entity
@Table(name = "cm_student")
public class Student extends Dao {

	private long id;



	@TextField(required = true, validate = validateType.ALPHABETIC)
	private String firstName;

	@TextField(validate = validateType.ALPHABETIC)
	private String middleName;

	@TextField(required = true, validate = validateType.ALPHABETIC)
	private String lastName;

	


	@TextField(required = true, validate = validateType.EMAIL)
	private String email;

	@TextField(validate = validateType.NUMERIC)
	private String telephone;
	
	@TextField(validate = validateType.NUMERIC)
	private String mobile;
	@TextField(validate = validateType.NUMERIC)
	private String civilRegister;


	@DropDown(property="displayName")
	private Gender gender;


	
	
	@Id
	@GeneratedValue(strategy = GenerationType.TABLE)
	public long getId() {
		return id;
	}

	
	@Transient
	public String getName() {

		return firstName + " " + (middleName == null ? "" : (middleName + " "))
				+ lastName;
	}


	public String getFirstName() {
		return firstName;
	}


	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}


	public String getMiddleName() {
		return middleName;
	}


	public void setMiddleName(String middleName) {
		this.middleName = middleName;
	}


	public String getLastName() {
		return lastName;
	}


	public void setLastName(String lastName) {
		this.lastName = lastName;
	}


	public String getEmail() {
		return email;
	}


	public void setEmail(String email) {
		this.email = email;
	}


	public String getTelephone() {
		return telephone;
	}


	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}


	public String getMobile() {
		return mobile;
	}


	public void setMobile(String mobile) {
		this.mobile = mobile;
	}


	public String getCivilRegister() {
		return civilRegister;
	}


	public void setCivilRegister(String civilRegister) {
		this.civilRegister = civilRegister;
	}


	public Gender getGender() {
		return gender;
	}


	public void setGender(Gender gender) {
		this.gender = gender;
	}


	public void setId(long id) {
		this.id = id;
	}


}
